package async;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;

/**
 * @author : zhouliangliang5
 * @date : 2023/3/17 10:36
 * @description :
 */
public class AsyncFuture {
    public static void main(String[] args) throws Exception{
        Callable<String> callable = new Callable<String>() {
            @Override
            public String call() throws Exception {
                return "callable";
            }
        };

        FutureTask<String> future = new FutureTask<>(callable);
        new Thread(future).start();
        String result = future.get(200, TimeUnit.MICROSECONDS);
        System.out.println(result);

    }
}
